<?php

namespace App\Admin\Controllers;

use App\Admin\Repositories\SfRemark;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class SfRemarkController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new SfRemark(), function (Grid $grid) {
            $grid->column('remark_id')->sortable();
            $grid->column('remark_text');
            $grid->column('user_num');
            $grid->column('shop_id','商品编号');
            $grid->column('mark');
            $grid->column('remark_status','审核状态')->radio([0=>'待审核',1=>'通过',2=>'驳回']);
            $grid->column('created_at');
            $grid->column('updated_at')->sortable();
        
            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('remark_id');
        
            });
        });
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     *
     * @return Show
     */
    protected function detail($id)
    {
        return Show::make($id, new SfRemark(), function (Show $show) {
            $show->field('remark_id');
            $show->field('remark_text');
            $show->field('user_num');
            $show->field('order_sn');
            $show->field('mark');
            $show->field('pid');
            $show->field('remark_status');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new SfRemark(), function (Form $form) {
            $form->display('remark_id');
            $form->text('remark_text');
            $form->text('user_num');
            $form->text('order_sn');
            $form->text('mark');
            $form->text('pid');
            $form->text('remark_status');
            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
